package com.social.service;

import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.social.dao.CommentReplyMapper;
import com.social.dao.TopicCommentMapper;
import com.social.dao.model.CommentReplyExample;
import com.social.dao.model.TopicComment;
import com.social.dao.model.TopicCommentExample;
import com.social.daoEx.TopicCommentMapperEx;
import com.social.daoEx.model.TopicCommentEx;

@Service
public class TopicCommentService {
    @Autowired
    private TopicCommentMapper topicCommentMapper;
    @Autowired
    private TopicCommentMapperEx topicCommentMapperEx;
    @Autowired
    private CommentReplyMapper replyMapper;

    private static final Logger logger = Logger.getLogger(TopicCommentService.class);

    public int countByExample(TopicCommentExample example) {
        return this.topicCommentMapper.countByExample(example);
    }

    public TopicComment selectByPrimaryKey(String id) {
        return this.topicCommentMapper.selectByPrimaryKey(id);
    }

    public List<TopicComment> selectByExample(TopicCommentExample example) {
        return this.topicCommentMapper.selectByExample(example);
    }

    public int deleteByPrimaryKey(String id) {
    	CommentReplyExample example = new CommentReplyExample();
    	example.createCriteria().andCommentIdEqualTo(id);
		replyMapper.deleteByExample(example);
        return this.topicCommentMapper.deleteByPrimaryKey(id);
    }

    public int updateByPrimaryKeySelective(TopicComment record) {
        return this.topicCommentMapper.updateByPrimaryKeySelective(record);
    }

    public int updateByPrimaryKey(TopicComment record) {
        return this.topicCommentMapper.updateByPrimaryKey(record);
    }

    public int deleteByExample(TopicCommentExample example) {
        return this.topicCommentMapper.deleteByExample(example);
    }

    public int updateByExampleSelective(TopicComment record, TopicCommentExample example) {
        return this.topicCommentMapper.updateByExampleSelective(record, example);
    }

    public int updateByExample(TopicComment record, TopicCommentExample example) {
        return this.topicCommentMapper.updateByExample(record, example);
    }

    public int insert(TopicComment record) {
        return this.topicCommentMapper.insert(record);
    }

    public int insertSelective(TopicComment record) {
        return this.topicCommentMapper.insertSelective(record);
    }

	public List<TopicCommentEx> selectAppList(Map<String, Object> map) {
		return topicCommentMapperEx.selectAppList(map);
	}

	public List<TopicCommentEx> selectCircleList(Map<String, Object> map) {
		return topicCommentMapperEx.selectCircleList(map);
	}

	public List<TopicCommentEx> selectUserCircleList(Map<String, Object> map) {
		return topicCommentMapperEx.selectUserCircleList(map);
	}

	public List<TopicCommentEx> selectWebCircleList(Map<String, Object> map) {
		return topicCommentMapperEx.selectWebCircleList(map);
	}

	public List<TopicCommentEx> selectWebCommentList(Map<String, Object> map) {
		return topicCommentMapperEx.selectWebCommentList(map);
	}
}